using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace XPStudio.UMS.Model
{
    public class UserModel
    {
        public enum UserValidateStatus
        {
            OK = 1,
            NotExist = 2,
            PasswordWrong = 3
        }

        public enum UserType
        {
            AllUser = 0,
            AdminUser = 1,
            ApprovedUser = 2,
            AllowUser = 3,
            ActiveUser = 4,
            OnlineUser = 5,
            NotAdminUser = 6,
            NotApprovedUser = 7,
            DenyUser = 8,
            NotActiveUser = 9,
            OfflineUser = 10
        }

        #region Model
        private int _userid;
        private string _username;
        private string _password;
        private int _passwordformat;
        private string _salt;
        private DateTime _datecreated;
        private int _gender;
        private string _email;
        private DateTime _lastlogindate;
        private string _loginip;
        private bool _isadmin;
        private bool _isallow;
        private bool _isapproved;
        private bool _isonline;
        private bool _isactive;
        private string _question;
        private string _answer;
        private int _point;
        private int _imageid;
        /// <summary>
        /// 
        /// </summary>
        public int UserID
        {
            set { _userid = value; }
            get { return _userid; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string UserName
        {
            set { _username = value; }
            get { return _username; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Password
        {
            set { _password = value; }
            get { return _password; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int PasswordFormat
        {
            set { _passwordformat = value; }
            get { return _passwordformat; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Salt
        {
            set { _salt = value; }
            get { return _salt; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime DateCreated
        {
            set { _datecreated = value; }
            get { return _datecreated; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Gender
        {
            set { _gender = value; }
            get { return _gender; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Email
        {
            set { _email = value; }
            get { return _email; }
        }
        /// <summary>
        /// 
        /// </summary>
        public DateTime LastLoginDate
        {
            set { _lastlogindate = value; }
            get { return _lastlogindate; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string LoginIP
        {
            set { _loginip = value; }
            get { return _loginip; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool IsAdmin
        {
            set { _isadmin = value; }
            get { return _isadmin; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool IsAllow
        {
            set { _isallow = value; }
            get { return _isallow; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool IsApproved
        {
            set { _isapproved = value; }
            get { return _isapproved; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool IsOnline
        {
            set { _isonline = value; }
            get { return _isonline; }
        }
        /// <summary>
        /// 
        /// </summary>
        public bool IsActive
        {
            set { _isactive = value; }
            get { return _isactive; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Question
        {
            set { _question = value; }
            get { return _question; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Answer
        {
            set { _answer = value; }
            get { return _answer; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Point
        {
            set { _point = value; }
            get { return _point; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int ImageID
        {
            set { _imageid = value; }
            get { return _imageid; }
        }
        #endregion Model

        public UserModel()
        { }

        public UserModel(int userid, string username, string password)
        {
            this.UserID = userid;
            this.UserName = username;
            this.Password = password;
            this.IsAdmin = false;
            this.IsOnline = false;
            if (ConfigurationManager.AppSettings["PasswordFormat"] == String.Empty)
                this.PasswordFormat = 0;
            else
                this.PasswordFormat = Convert.ToInt32(ConfigurationManager.AppSettings["PasswordFormat"]);
            this.Answer = null;
            this.Question = null;
        }

        public UserModel(int userid, string username, string password, int passwordformat,
            string salt, DateTime datecreated, string useremail, string question, string answer, bool isadmin)
        {
            this.UserID = userid;
            this.UserName = username;
            this.Password = password;
            this.PasswordFormat = passwordformat;
            this.Salt = salt;
            this.DateCreated = datecreated;
            this.Email = useremail;
            this.Question = question;
            this.Answer = answer;
            this.IsAdmin = isadmin;
            this.IsOnline = false;
        }

    }
}
